<div class="" id="main">
    <div class="property-single white-bg clearfix" id="page-body">

        <!-- Property Images -->
        <div id="roayal-image-slider-wrapper">
            <div class="royalSlider default clearfix" id="roayal-image-slider" style="overflow: visible;">
                <!-- Slider -->
                <div class="royalWrapper"><ul class="royalSlidesContainer clearfix grab-cursor" style="left: -5840px; width: 7592px;">
                        <li class="royalSlide" style="height: 222px; width: 292px;"><img src="<?= (isset($listing->property_images) && count($listing->property_images) > 0 ) ? $listing->property_images[0]->image_url : base_url() . 'img/noimage.png' ?>" class="royalImage" style="opacity: 1;"></li>
                        <? foreach ($listing->property_images as $img): ?>
                            <li class="royalSlide" style="height: 222px; width: 292px;"><img src="<?= $img->image_url ?>"></li>
                        <? endforeach; ?>
                    </ul></div>
            </div>
        </div>

        <!-- Main property details -->
        <div class="property-content-wrapper">
            <!-- Title, price and address -->
            <h4 class=" title"><?= $listing->headline ?></h4>
            <?php
            $price = $listing->display_price;
            if ($price == '' && $listing->price_min != $listing->price_max)
                $price = '$' . $listing->price_min . ' to $' . $listing->price_max;
            else if ($price == '' && $listing->price_min == $listing->price_max)
                $price = '$' . $listing->price_min;
            ?>
            <span class="price"><?= $price ?></span>
            <span class="address museo bold"><?= (isset($listing->agentlocation_addr_street1)) ? $listing->agentlocation_addr_street1 : '' ?>  <?= $listing->agentlocation_addr_suburb ?> <?= $listing->agentlocation_addr_state ?> <?= $listing->agentlocation_addr_pcode ?> </span>

            <!-- Property price and meta data -->
            <p class="particulars clearfix">
                <span class="picon beds">4</span>			
                <span class="picon baths">3</span>				
                <span class="picon cars">2</span>			
            </p>

            <!-- Property Details -->
            <div class="details clearfix">

                <!-- Description -->
                <?= $listing->description ?>

                <!-- Features -->
                <h2 class="gogecko-orange">Features</h2>
                <ul>
                    <?= ($listing->exterior_type != '') ? '<li>exterior type: ' . $listing->exterior_type . '</li>' : '' ?>
                    <?= ($listing->roofing_type != '') ? '<li>roofing type: ' . $listing->roofing_type . '</li>' : '' ?>
                    <?= ($listing->building_size != '0.0000' && $listing->building_size != '') ? '<li>building size: ' . $listing->building_size . ' ' . $listing->building_size_type . '</li>' : '' ?>
                    <?= ($listing->year_built != '0000' && $listing->year_built != '') ? '<li>year built: ' . $listing->year_built . '</li>' : '' ?>

                    <?= ($listing->land_crossover != '') ? '<li>land crossover: ' . $listing->land_crossover . '</li>' : '' ?>
                    <?= ($listing->land_frontage != '0.0000' && $listing->land_frontage != null ) ? '<li>land frontage: ' . $listing->land_frontage . ' ' . $listing->land_frontage_unit . '</li>' : '' ?>
                    <?= ($listing->land_depth != '0.0000' && $listing->land_depth != null ) ? '<li>land depth: ' . $listing->land_depth . ' ' . $listing->land_depth_unit . '</li>' : '' ?>
                    <?= ($listing->land_depthleft != '0.0000' && $listing->land_depthleft != null ) ? '<li>land depth left: ' . $listing->land_depthleft . ' ' . $listing->land_depthleft_unit . '</li>' : '' ?>
                    <?= ($listing->land_depthright != '0.0000' && $listing->land_depthright != null ) ? '<li>land depth right: ' . $listing->land_depthright . ' ' . $listing->land_depthright_unit . '</li>' : '' ?>
                    <?= ($listing->land_depthrear != '0.0000' && $listing->land_depthrear != null ) ? '<li>land depth rear: ' . $listing->land_depthrear . ' ' . $listing->land_depthrear_unit . '</li>' : '' ?>

                    <?= ($listing->allowances_pet_friendly != 0) ? '<li>allowances pet friendly</li>' : '' ?>
                    <?= ($listing->allowances_smoker != 0) ? '<li>allowances smoker</li>' : '' ?>
                    <?= ($listing->allowances_furnished != 0) ? '<li>allowances furnished</li>' : '' ?>
                    <?= ($listing->study != 0) ? '<li>study</li>' : '' ?>
                    <?= ($listing->dishwasher != 0) ? '<li>dishwasher</li>' : '' ?>
                    <?= ($listing->built_in_robes != 0) ? '<li>built in robes</li>' : '' ?>
                    <?= ($listing->gym != 0) ? '<li>gym</li>' : '' ?>
                    <?= ($listing->workshop != 0) ? '<li>study</li>' : '' ?>
                    <?= ($listing->study != 0) ? '<li>workshop</li>' : '' ?>
                    <?= ($listing->rumpus_room != 0) ? '<li>rumpus room</li>' : '' ?>
                    <?= ($listing->floorboards != 0) ? '<li>floorboards</li>' : '' ?>
                    <?= ($listing->broadband != 0) ? '<li>broadband</li>' : '' ?>
                    <?= ($listing->pay_tv != 0) ? '<li>pay_tv</li>' : '' ?>
                    <?= ($listing->ducted_heating != 0) ? '<li>ducted heating</li>' : '' ?>
                    <?= ($listing->ducted_cooling != 0) ? '<li>ducted cooling</li>' : '' ?>
                    <?= ($listing->splitsystem_heating != 0) ? '<li>splitsystem heating</li>' : '' ?>
                    <?= ($listing->hydronic_heating != 0) ? '<li>hydronic heating</li>' : '' ?>
                    <?= ($listing->splitsystem_aircon != 0) ? '<li>splitsystem aircon</li>' : '' ?>
                    <?= ($listing->gas_heating != 0) ? '<li>gas heating</li>' : '' ?>
                    <?= ($listing->reverse_cycle_aircon != 0) ? '<li>reverse cycle aircon</li>' : '' ?>
                    <?= ($listing->evaporative_cooling != 0) ? '<li>evaporative cooling</li>' : '' ?>
                    <?= ($listing->air_conditioning != 0) ? '<li>air conditioning</li>' : '' ?>
                    <?= ($listing->alarm_system != 0) ? '<li>alarm system</li>' : '' ?>
                    <?= ($listing->vacuum_system != 0) ? '<li>vacuum system</li>' : '' ?>
                    <?= ($listing->pool != 0) ? '<li>pool</li>' : '' ?>
                    <?= ($listing->spa != 0) ? '<li>spa</li>' : '' ?>
                    <?= ($listing->tennis_court != 0) ? '<li>tennis court</li>' : '' ?>
                    <?= ($listing->balcony != 0) ? '<li>balcony</li>' : '' ?>
                    <?= ($listing->deck != 0) ? '<li>deck</li>' : '' ?>
                    <?= ($listing->courtyard != 0) ? '<li>courtyard</li>' : '' ?>
                    <?= ($listing->outdoor_ent != 0) ? '<li>outdoor ent</li>' : '' ?>
                    <?= ($listing->shed != 0) ? '<li>shed</li>' : '' ?>
                    <?= ($listing->fully_fenced != 0) ? '<li>fully fenced</li>' : '' ?>
                    <?= ($listing->open_fire_place != 0) ? '<li>open fire place</li>' : '' ?>
                    <?= ($listing->open_spaces != 0) ? '<li>open spaces:' . $listing->open_spaces . ' </li>' : '' ?>
                    <?= ($listing->heating_type != '') ? '<li>heating type:' . $listing->heating_type . ' </li>' : '' ?>
                    <?= ($listing->hot_water_service != '') ? '<li>hot water service:' . $listing->hot_water_service . '</li>' : '' ?>
                    <?= ($listing->inside_spa != 0) ? '<li>inside spa</li>' : '' ?>
                    <?= ($listing->outside_spa != 0) ? '<li>outside spa</li>' : '' ?>

                    <?= ($listing->other_features != '') ? '<li>other features: ' . $listing->other_features . '</li>' : '' ?>
                    <?= ($listing->rural_features_fencing != '') ? '<li>fencing: ' . $listing->rural_features_fencing . '</li>' : '' ?>
                    <?= ($listing->rural_features_annual_rainfall != '') ? '<li>annual rainfall: ' . $listing->rural_features_annual_rainfall . '</li>' : '' ?>
                    <?= ($listing->rural_features_soiltypes != '') ? '<li>soiltypes: ' . $listing->rural_features_soiltypes . '</li>' : '' ?>
                    <?= ($listing->rural_features_improvements != '') ? '<li>improvements: ' . $listing->rural_features_improvements . '</li>' : '' ?>
                    <?= ($listing->rural_features_councilrates != '') ? '<li>councilrates: ' . $listing->rural_features_councilrates . '</li>' : '' ?>
                    <?= ($listing->rural_features_irrigation != '') ? '<li>irrigation: ' . $listing->rural_features_irrigation . '</li>' : '' ?>
                    <?= ($listing->rural_features_carryingcapacity != '') ? '<li>carrying capacity: ' . $listing->rural_features_carryingcapacity . '</li>' : '' ?>
                    <?= ($listing->rural_features_services != '') ? '<li>services: ' . $listing->rural_features_services . '</li>' : '' ?>

                    <?= ($listing->eco_friendly_solar_panels != 0) ? '<li>solar panels</li>' : '' ?>
                    <?= ($listing->eco_friendly_solar_hot_water != 0) ? '<li>solar hot water</li>' : '' ?>
                    <?= ($listing->eco_friendly_water_tank != 0) ? '<li>eco friendly water tank</li>' : '' ?>
                    <?= ($listing->eco_friendly_grey_water_system != 0) ? '<li>eco friendly grey water system</li>' : '' ?>
                    <?= ($listing->idealfor_first_home_buyer != 0) ? '<li>ideal for first home buyer</li>' : '' ?>
                    <?= ($listing->idealfor_investors != 0) ? '<li>ideal for investors</li>' : '' ?>
                    <?= ($listing->idealfor_downsizing != 0) ? '<li>ideal for downsizing</li>' : '' ?>
                    <?= ($listing->idealfor_couples != 0) ? '<li>ideal for couples</li>' : '' ?>
                    <?= ($listing->idealfor_students != 0) ? '<li>ideal for students</li>' : '' ?>
                    <?= ($listing->idealfor_irg_families != 0) ? '<li>ideal for irg families</li>' : '' ?>
                    <?= ($listing->idealfor_reitrees != 0) ? '<li>ideal for reitrees</li>' : '' ?>

                    <?= ($listing->views_city != 0) ? '<li>views city</li>' : '' ?>
                    <?= ($listing->views_water != 0) ? '<li>views water</li>' : '' ?>
                    <?= ($listing->views_valley != 0) ? '<li>views valley</li>' : '' ?>
                    <?= ($listing->views_mountain != 0) ? '<li>views mountain</li>' : '' ?>
                    <?= ($listing->views_ocean != 0) ? '<li>views ocean</li>' : '' ?>
                    <?= ($listing->property_extent != '') ? '<li>property extent:' . $listing->property_extent . '</li>' : '' ?>

                    <?= ($listing->car_spaces != 0) ? '<li>car spaces:' . $listing->car_spaces . '</li>' : '' ?>
                    <?= ($listing->parking_comments != '') ? '<li>parking comments:' . $listing->parking_comments . '</li>' : '' ?>

                </ul>
            </div>     
        </div>

        <!-- Output Auction time -->



        <!-- Contact Agent -->
        <div class="agent-wrapper"> 

            <a id="agent-contact-trigger" class="title bold"><span class="arrow"></span>Contact agent</a>

            <div style="display:none;" class="agent-content clearfix">

                <!-- Belonged agency details -->
                <div class="office-details">

                    <h4>Office details</h3>
                        <strong><?= $listing->agentname ?></strong>            
                        <?= (isset($listing->agentlocation_addr_street1)) ? '<br/>' . $listing->agentlocation_addr_street1 : '' ?>
                        <?= (isset($listing->agentlocation_addr_street2)) ? '<br/>' . $listing->agentlocation_addr_street2 : '' ?>
                        <br/><?= $listing->agentlocation_addr_suburb ?> <?= $listing->agentlocation_addr_state ?> <?= $listing->agentlocation_addr_pcode ?> 

                        <?= (isset($listing->agentphone) && $listing->agentphone != '') ? '<br/><strong>Phone: </strong>' . $listing->agentphone : '' ?>
                        <?= (isset($listing->agentfax) && $listing->agentfax != '') ? '<br/><strong>Fax: </strong>' . $listing->agentfax : '' ?>

                        <h4>Agent details</h3>

                            <strong><?= (isset($listing->managerfname) && $listing->managerfname != '') ? $listing->managerfname . ' ' . $listing->managerlname : 'Agent name' ?></strong>
                            <?= (isset($listing->managerphone) && $listing->managerphone != '') ? '<br/><strong>Phone: </strong>' . $listing->managerphone : '' ?>

                            </div>

                            <a id="enquire-now" class="email-agent active" href="#">Email Agent</a>
                            <div style="display:none;" id="enquire-form-wrapper">
                                <div class="enquire-divider" style="margin-left: -10px;"></div>
                                <div class=" form clearfix"  id="enquire-form-content">

                                    <div id="form-error-msg"></div>
                                    <form action="" class="cform enquiryproperty" method="post" enctype="multipart/form-data" id="enquiryproperty">
                                        <input value="707" name="agencyID" style="display:none;">
                                        <ol class="cf-ol">
                                            <input id="emailagent_manageremail" name="emailagent_manageremail" type="hidden" value="<?= $listing->manageremail ?>" />
                                            <input id="emailagent_emailID" name="emailagent_emailID" type="hidden" value="<?= $listing->agentemail ?>" />
                                            <li><label for="name"><span>Your Name * </span></label><input type="text" onblur="setField(this)" onfocus="clearField(this)" placeholder="name" value="" class="single fldrequired" id="emailagent_name" name="emailagent_name"><span class="reqtxt"></span></li>
                                            <li><label for="emailAddress"><span>Email address *  </span></label><input type="text" onblur="setField(this)" onfocus="clearField(this)" placeholder="email" value="" class="single fldemail fldrequired" id="emailagent_email" name="emailagent_email"><span class="emailreqtxt"></span></li>
                                            <li><label for="mobile"><span>Mobile number </span></label><input type="text" onblur="setField(this)" onfocus="clearField(this)" placeholder="mobile" value="" class="single" id="emailagent_mobile" name="emailagent_mobile"></li>
                                            <li><label for="message"><span>Message* </span></label><textarea class="area fldrequired" id="emailagent_message" name="emailagent_message" rows="8" cols="30"></textarea><span class="reqtxt"></span></li>
                                        </ol>
                                        <p class="cf-sb"><input type="submit" value="Submit" class="sendbutton" id="sendbutton2" name="sendbutton2"></p>										</form>
                                    <a href="#" class="form-cancel" id="form-cancel">CANCEL</a>
                                </div>
                            </div>
                            </div>
                            </div>



                            </div>
                            <link rel="stylesheet" href="<?php echo base_url(); ?>/css/royalslider.css">
                            <script type="text/javascript" src="<?php echo base_url(); ?>/js/royal-slider-8.1.min.js"></script>
                            <script type="text/javascript">
                                function validateEmail($email) {
                                    var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
                                    if( !emailReg.test( $email ) ) {
                                        return false;
                                    } else {
                                        return true;
                                    }
                                }
                                $(document).ready(function(){
                                    $('form#enquiryproperty').submit(function() {
                                        var emailagent_emailID = $('#emailagent_emailID').val();
                                        var emailagent_name = $('#emailagent_name').val();
                                        var emailagent_email = $('#emailagent_email').val();
                                        var emailagent_mobile = $('#emailagent_mobile').val();
                                        var emailagent_message = $('#emailagent_message').val();
                                        var emailagent_manageremail=$('#emailagent_manageremail').val();
                                        
                    
                                        if( $.trim(emailagent_name)=="" ){
                                            $('#emailagent_name').addClass('error');
                                            $('#enquiryproperty .showError').html('Enter your name');
                                            
                                        } else if( $.trim(emailagent_email)=="" || validateEmail(emailagent_email) == false){
                                            $('#emailagent_name').addClass('required');
                                            $('#emailagent_email').addClass('error');
                                            $('#enquiryproperty  .showError').html('Enter valid email');
                                           
                                        }else{
                                            
                                            $('#enquiryproperty').addClass('class','required');
                                            $('#enquiryproperty  .showError').html('Sending...');
                                            var form_data = $('#enquiryproperty').serialize();
                                            //Begin the ajax call
                                            $.ajax({
                                                type:"post",
                                                data: {emailagent_emailID: emailagent_emailID,emailagent_name:emailagent_name,emailagent_email:emailagent_email,emailagent_mobile:emailagent_mobile,emailagent_message:emailagent_message,emailagent_manageremail:emailagent_manageremail},
                                                url:'<?= site_url('property/emailagent') ?>',
                                                success: function(data) {
                                                    if(data==1){
                                                        //open feedback                                    
                                                        $('#enquiryproperty .showSuccess').html('Your message has been sent, a Sales Agent will be in contact with you directly.');
                                                    }else{
                                                        $('#enquiryproperty .showError').html('Unable to send mail. Try again later');
                                                    }     
                                                   
                                                }
                                            
                                            });
                                        }
                                        return false;
                                    });
                                    
                                });
                                (function($) {
                                    // Form dropdown button
                                    $(function() {
               
                                        var mcontent = $("#enquire-form-wrapper");
                                        var mtrigger = $("#enquire-now");
                                        var mcancel = $("#form-cancel")
                

                                        mtrigger.click(function(e) {
                                            e.preventDefault();
                                            if (mcontent.is(":visible")) {
                                                mcontent.slideUp(500);
                                                mtrigger.removeClass('active');
                                            } else {
                                                mcontent.slideDown(500);
                                                mtrigger.addClass('active');
                                            }
                                        });
                                        mcancel.click(function(e) {
                                            e.preventDefault();
                                            if (mcontent.is(":visible")) {
                                                mcontent.slideUp(500);
                                                mtrigger.removeClass('active');
                                            }
                                        });

                                    });

                                })(jQuery);
                                (function($) {

                                    // Agency and agent detail dropdown button
                                    $(function() {
                                        var content = $(".agent-content");
                                        var trigger = $("#agent-contact-trigger");

                                        trigger.click(function() {
                                            if (content.is(":visible")) {
                                                content.slideUp(500);
                                                trigger.removeClass('active');
                                            } else {
                                                content.slideDown(500);
                                                trigger.addClass('active');
                                            }
                                        });
                                    });

                                    $(function(){
                                        // Royal slider
                                        $("#roayal-image-slider ").royalSlider({
                                            directionNavEnabled: false,
                                            controlNavThumbsNavigation: false,
                                            controlNavEnabled: false,
                                            directionNavAutoHide: true,
                                            beforeSlideChange: function(){

                                            },
                                            afterSlideChange: function(){

                                            },

                                            /* other options go here, view javascript options to learn more */			
                                        });  

                                        // Initial slider width
                                        //var image_width = 290;
                                        //var image_margin = 1;
                                        //var image_count = $(".image-slider ul li").length;
                                        //var slider_length = image_count * (image_width + image_margin) + image_margin;
                                        //$(".image-slider ul").css("width", slider_length + 'px');
                                    });

                                })(jQuery);
                                
                            </script>
                            </div>